package com.bjwl.web.contrlller.branchstore;

import com.bjwl.pojo.Attend;
import com.bjwl.pojo.Bsadmin;
import com.bjwl.pojo.Settlement;
import com.bjwl.pojo.dto.AttendBrDto;
import com.bjwl.service.AttendService;
import com.bjwl.utils.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @Author: czc
 * @Date:Create：in 2020/5/20 11:30
 * @Description:
 * @Modified By：
 * @Version: 1.0
 */
@Controller
@RequestMapping("/attend")
public class AttendController {

    @Autowired
    private AttendService attendService;

    @RequestMapping("/jumpAttendList")
    public String jumpAttendList(){

        return "branch_oa/attend-list";
    }

    @RequestMapping("/findAllAttend")
    public String findAllAttend(HttpSession httpSession, HttpServletRequest request, Integer bsid, Integer pageNum, String wstarttime , String wendtime , String staffname ) {
        if(pageNum == null){
            pageNum =1;
        }
        Bsadmin bsadmin1 = (Bsadmin) httpSession.getAttribute("bsadmin1");
        bsid = bsadmin1.getBsid();

        PageBean<Attend> attendList = attendService.findAllAttend(pageNum,bsid,wstarttime,wendtime ,staffname);
        request.setAttribute("attendList", attendList);
        AttendBrDto attendBrDto = new AttendBrDto(wstarttime,wendtime,staffname);
        request.setAttribute("attendBrDto",attendBrDto);
        return "branch_oa/attend-list";

    }


    @RequestMapping("/jumpEditAttend")
    public String jumpEditAttend(){

        return "branch_oa/attend-edit";
    }
}
